package org.jvnet.hudson.client_demo;

import java.net.MalformedURLException;

import org.codehaus.cargo.container.ContainerType;
import org.codehaus.cargo.container.InstalledLocalContainer;
import org.codehaus.cargo.container.configuration.ConfigurationType;
import org.codehaus.cargo.container.configuration.LocalConfiguration;
import org.codehaus.cargo.container.deployable.WAR;
import org.codehaus.cargo.container.tomcat.Tomcat6xInstalledLocalContainer;
import org.codehaus.cargo.container.tomcat.Tomcat6xStandaloneLocalConfiguration;
import org.codehaus.cargo.generic.DefaultContainerFactory;
import org.codehaus.cargo.generic.configuration.DefaultConfigurationFactory;

public class DeployerTomcat {

	final static String TOMCAT_HOME = "D:\\apache-tomcat-6.0.37";
	/*
	 * static JBoss72xInstalledLocalContainer container = null; static
	 * JBoss72xStandaloneLocalConfiguration configuration = null;
	 */
	final static String USER = "Arthur";
	final static String PASSWORD = "abcd1234";

	public static void main(String[] args) throws MalformedURLException {
		

		// (2) Create the Cargo Container instance wrapping our physical container
		Tomcat6xStandaloneLocalConfiguration configuration = (Tomcat6xStandaloneLocalConfiguration) new DefaultConfigurationFactory()
		        .createConfiguration("tomcat6x", ContainerType.INSTALLED, ConfigurationType.STANDALONE);
		Tomcat6xInstalledLocalContainer container = (Tomcat6xInstalledLocalContainer) new DefaultContainerFactory()
		        .createContainer("tomcat6x", ContainerType.INSTALLED, configuration);
		container.setHome(TOMCAT_HOME);

		// (3) Statically deploy some WAR (optional)
		WAR deployable = new WAR("C:\\Users\\Arthur\\Dropbox\\Arthur\\wsElegance\\sysflow2\\target\\sysflow2.war");
		deployable.setContext("ROOT");
		configuration.addDeployable(deployable);

		container.stop();
		System.out.println("Tomcat stop.");

	}
}
